/**
* Copyright (c) By zengqh.
*
* This program is just for fun or demo, in the hope that it  
* will be useful, you can redistribute it and/or modify freely.
*
* Time: 2012/07/11
* File: RenderSystem.h
* Blog: http://www.cnblogs.com/zengqh/
**/

#ifndef RenderSystem_h__
#define RenderSystem_h__

#include "../Core/Core.h"
#include "../Core/Declare.h"
#include "LightData.h"
#include "MaterialData.h"
#include "FrameListener.h"

class RenderSystem
{
public:
	virtual ~RenderSystem() {}

	virtual bool beginScene() = 0;
	virtual bool endScene() = 0;

	virtual void setTransform(TransformState state, const glm::mat4& transform) = 0;
	virtual const glm::mat4& getTransform(TransformState state) const = 0;

	virtual void setViewport(const Recti& view_port) = 0;
	virtual const Recti& getViewport() const = 0;

	virtual s32 getType() const = 0;

	virtual void setFVF(FVFState fvf) = 0;

	virtual void setGraphicsBuffer(BufferState state, GraphicsBuffer* graphics_buffer) = 0;

	virtual void setEffect(Effect* effect) = 0;

	virtual void setMaterial(MaterialData* material_data) = 0;

	virtual const MaterialData& getMaterial() const = 0;

	virtual void addLight(LightData* light_data) = 0;

	virtual const LightData& getLight(int index) const = 0;

	virtual void deleteAllLights() = 0;

	virtual void drawPrimitiveIndex(u32 primitive_count, PrimitiveState mode, u32 offset, bool is_index_16) = 0;

	virtual Texture* createTexture(const char* path, bool is_mipmap = false) = 0;

	virtual GraphicsBuffer* createGraphicsBuffer(
		BufferUsage usage, 
		u32 access_hint, 
		BufferState target, 
		void* init_data = NULL, 
		u32 size = 0) = 0;

	virtual void clearColor(const glm::vec4& color) = 0;
	virtual void clearZBuffer() = 0;

	virtual void addFrameListener(FrameListener* listener) = 0;

	virtual void setEffectService(EffectService* es) = 0;

	virtual Effect* createEffect() = 0;

	virtual void setRenderTarget(RenderTarget* rt) = 0;

	virtual RenderTarget* createRTT(const Dimension2Di& size) = 0;
};

#endif    /* RenderSystem_h__ */